<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       Function.prototype.myBind = function(thisArg,...args)
       {
           if(typeof this!="function")
           {
             throw TypeError(thisArg+"is not a function");
           }
           const fn = this;
           return function(...newArgs)
           {
              return fn.apply(thisArg,[...args,...newArgs]);
           }
       }


       let person = {
         name:"cq",
         age:"34"
       }

       function sum(a,b)
       {
         return a+b;
       }

       let sum10 = sum.myBind(person,10);
       console.log(sum10(100));
       console.log(sum10(300));
       console.log(sum10(500));
    </script>
</body>
</html>